<?php

session_start();

$section = $_SESSION['section'];

if(isset($_GET['lang']))
{
	$language = $_GET['lang'];
	

	// I don't cast directly. Just in case, if someone puts an invalid URL.
	
	switch($language)
	{
		case "es": $_SESSION['language'] = "es"; break;
		case "en": $_SESSION['language'] = "en"; break;
	}
	
	// We build the new url, so the index can read the content.
	$_SESSION['content'] = "languages/contents/".$_SESSION['section']."_".$_SESSION['language'].".php";
}
/*
if(!is_null($referer))
	header("Location: $referer");
else
	header("Location: index.php");
	*/

header("Location: index.php");
//var_dump("test");
	